import os

project_root_dir = os.path.dirname(os.path.abspath(__file__))


class Common:
    class Export:
        class Dir:
            export_csv_base_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}" \
                                   f"export{os.sep}dir{os.sep}export.csv"
            export_excel_base_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}" \
                                     f"export{os.sep}dir{os.sep}export.xlsx"
            export_dir_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}export{os.sep}dir"

        class Excel:
            export_excel_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}export" \
                                f"{os.sep}excel{os.sep}export.xlsx"
            export_excel_dir_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}export" \
                                    f"{os.sep}excel"

        class Csv:
            export_csv_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}export" \
                              f"{os.sep}csv{os.sep}export.csv"
            export_csv_dir_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}export" \
                                  f"{os.sep}csv"
            export_csv_path2 = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}export" \
                               f"{os.sep}csv{os.sep}export2.csv"

    class Import:
        class Dir:
            import_dir_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}import" \
                              f"{os.sep}dir"

        class Excel:
            import_excel_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}import" \
                                f"{os.sep}excel{os.sep}import.xlsx"
            import_excel_dir_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}import" \
                                    f"{os.sep}excel"

        class Csv:
            import_csv_path_2 = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}import" \
                                f"{os.sep}csv{os.sep}import_2.csv"
            import_csv_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}import" \
                              f"{os.sep}csv{os.sep}import.csv"
            import_csv_dir_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}import" \
                                  f"{os.sep}csv"

        class Txt:
            import_txt_path = f"{project_root_dir}{os.sep}data{os.sep}common{os.sep}import" \
                              f"{os.sep}txt{os.sep}import.txt"


class ChromeDriver:
    chrome_driver_path = f"{project_root_dir}{os.sep}etc{os.sep}chromedriver.exe"


'''
通用的读写文件目录
'''
import_csv_path = Common.Import.Csv.import_csv_path
import_txt_path = Common.Import.Txt.import_txt_path
import_csv_path_2 = Common.Import.Csv.import_csv_path_2
import_csv_dir_path = Common.Import.Csv.import_csv_dir_path
import_excel_path = Common.Import.Excel.import_excel_path
import_excel_dir_path = Common.Import.Excel.import_excel_dir_path
import_dir_path = Common.Import.Dir.import_dir_path

export_csv_path = Common.Export.Csv.export_csv_path
export_csv_dir_path = Common.Export.Csv.export_csv_dir_path
export_csv_path2 = Common.Export.Csv.export_csv_path2
export_excel_path = Common.Export.Excel.export_excel_path
export_excel_dir_path = Common.Export.Excel.export_excel_dir_path
export_dir_path = Common.Export.Dir.export_dir_path
export_csv_base_path = Common.Export.Dir.export_csv_base_path
export_excel_base_path = Common.Export.Dir.export_excel_base_path

"""
其他数据
"""
font_file_path = f"{project_root_dir}{os.sep}etc{os.sep}msyh.ttf"
jieba_area_dict_file_path = f"{project_root_dir}{os.sep}etc{os.sep}sca_area_jieba_dict.csv"
jieba_name_dict_file_path = f"{project_root_dir}{os.sep}etc{os.sep}sca_client_name_jieba_dict.csv"
jieba_area_white_list_file_path = f"{project_root_dir}{os.sep}etc{os.sep}sca_area_white_list.csv"
invalid_4_clean_name_1 = f"{project_root_dir}{os.sep}etc{os.sep}invalid_4_clean_name_1.csv"
invalid_4_clean_name_2 = f"{project_root_dir}{os.sep}etc{os.sep}invalid_4_clean_name_2.csv"
jieba_area_cut_dict_file_path = f"{project_root_dir}{os.sep}etc{os.sep}area_cut_dict.csv"
jieba_proper_word_cut_dict_file_path = f"{project_root_dir}{os.sep}etc{os.sep}proper_word_cut_dict.csv"
jieba_compare_name2_file_path = f"{project_root_dir}{os.sep}etc{os.sep}sca_area_dict_level3_4_compare_name2.csv"
area_cascade_file_path = f"{project_root_dir}{os.sep}etc{os.sep}sca_area_cascade_relationship_4_compare_name2.csv"
jieba_empty_dict_file_path = f"{project_root_dir}{os.sep}etc{os.sep}jieba_dict.empty"
operate_record_db = f"{project_root_dir}{os.sep}etc{os.sep}sca_antPlus_operate_record"
'''
日志 数据  目录
'''
default_io_log_file_path = f"{project_root_dir}{os.sep}data{os.sep}log{os.sep}io{os.sep}io.log"
default_io_log_dir_path = f"{project_root_dir}{os.sep}data{os.sep}log{os.sep}io"
default_console_log_file_path = f"{project_root_dir}{os.sep}data{os.sep}log{os.sep}console{os.sep}console.log"
default_console_dir_file_path = f"{project_root_dir}{os.sep}data{os.sep}log{os.sep}console"
default_error_log_file_path = f"{project_root_dir}{os.sep}data{os.sep}log{os.sep}error{os.sep}error.log"
default_error_dir_file_path = f"{project_root_dir}{os.sep}data{os.sep}log{os.sep}error"
default_chrome_log_file_path = f"{project_root_dir}{os.sep}data{os.sep}log{os.sep}chrome{os.sep}chrome.log"
default_chrome_dir_file_path = f"{project_root_dir}{os.sep}data{os.sep}log{os.sep}chrome"

'''
浏览器 chromedriver 所在路径
'''
chrome_driver_path = ChromeDriver.chrome_driver_path

# 自动创建对应的文件夹
dir_path_list = [
    import_csv_dir_path
    , import_excel_dir_path
    , import_dir_path
    , export_csv_dir_path
    , export_excel_dir_path
    , export_dir_path
    , default_io_log_dir_path
    , default_console_dir_file_path
    , default_error_dir_file_path
    , default_chrome_dir_file_path
]

for dir_path in dir_path_list:
    if not os.path.exists(dir_path):
        os.makedirs(dir_path)
